home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / nihcl-30.lha / nihcl-3.0 / ex / ex8-3.c < prev    next >
C/C++ Source or Header  |  1990-05-15  |  696b  |  31 lines

  1. // ex8-3.c -- Nested Iterators
  2.  
  3. // $Header: /afs/alw.nih.gov/unix/sun4_40c/usr/local/src/nihcl-3.0/share/ex/RCS/ex8-3.c,v 3.0 90/05/15 22:46:16 kgorlen Rel $
  4.  
  5. #include "OrderedCltn.h"
  6. #include "Iterator.h"
  7. #include "String.h"
  8.  
  9. void printPairs(const Collection& c1, const Collection& c2)
  10. {
  11.     Iterator it1(c1), it2(c2);
  12.  
  13.     while(it1++) {
  14.         while (it2++) {
  15.             cout << '[' << *it1() << ',' << *it2() << "]  ";
  16.         }
  17.         cout << endl;
  18.         it2.reset();
  19.     }
  20. }
  21.  
  22. main()
  23. {
  24.     OrderedCltn symbols;
  25.     symbols.add(*new String("A"));
  26.     symbols.add(*new String("C"));
  27.     symbols.add(*new String("G"));
  28.     symbols.add(*new String("T"));
  29.     printPairs(symbols,symbols);
  30. }
  31.